CSharpTest.Net
Equals(T) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Bases Namespace > Equatable<T> Class > Equals Method : Equals(T) Method

other

Glossary Item Box

Returns true if the other object is equal to this one

Syntax

Visual Basic (Declaration) 
Public Overloads MustOverride Function Equals( _
   ByVal other As T _
) As Boolean
C# 
public abstract bool Equals( 
   T other
)

Parameters

other

Example

Library/Library.Test/TestSalt.cs

C#Copy Code
Salt s = new Salt();
Salt scopy = Salt.FromBytes(s.ToArray());

Assert.AreEqual(s, scopy);
Assert.IsTrue(s.Equals(scopy));
Assert.IsTrue(s.Equals((object)scopy));
Assert.IsTrue(s == scopy);
Assert.IsFalse(s != scopy);
Assert.AreEqual(s.GetHashCode(), scopy.GetHashCode());

scopy = new Salt();
Assert.AreNotEqual(s, scopy);
Assert.IsFalse(s.Equals(scopy));
Assert.IsFalse(s.Equals((object)scopy));
Assert.IsFalse(s == scopy);
Assert.IsTrue(s != scopy);
Assert.AreNotEqual(s.GetHashCode(), scopy.GetHashCode());
VB.NETCopy Code
Dim s As New Salt()
Dim scopy As Salt = Salt.FromBytes(s.ToArray())

Assert.AreEqual(s, scopy)
Assert.IsTrue(s.Equals(scopy))
Assert.IsTrue(s.Equals(DirectCast(scopy, Object)))
Assert.IsTrue(s = scopy)
Assert.IsFalse(s <> scopy)
Assert.AreEqual(s.GetHashCode(), scopy.GetHashCode())

scopy = New Salt()
Assert.AreNotEqual(s, scopy)
Assert.IsFalse(s.Equals(scopy))
Assert.IsFalse(s.Equals(DirectCast(scopy, Object)))
Assert.IsFalse(s = scopy)
Assert.IsTrue(s <> scopy)
Assert.AreNotEqual(s.GetHashCode(), scopy.GetHashCode())

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys